#!/bin/sh

set -e

VERSION=$(cat VERSION)
DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST:-hub.docker.com}
DOCKER_IMAGE=${DOCKER_IMAGE:-sameersbn/gitlab}

docker build -t $DOCKER_IMAGE .

docker tag $DOCKER_IMAGE $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:latest
docker tag $DOCKER_IMAGE $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:$VERSION

docker push $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:latest
docker push $DOCKER_REGISTRY_HOST/$DOCKER_IMAGE:$VERSION
